package com.smart.community.feign.region.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 区域层级信息DTO
 * 用于返回房户所属的完整层级结构信息，支持缴费系统根据房户ID快速定位物业公司
 * 
 * @author Wu.Liang
 * @version 1.0.0
 * @since 2025-01-30
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "区域层级信息")
public class RegionHierarchyInfo implements Serializable {
    
    private static final long serialVersionUID = 1L;
    
    @Schema(description = "房户ID")
    private Long householdId;
    
    @Schema(description = "房户名称")
    private String householdName;
    
    @Schema(description = "单元ID")
    private Long unitId;
    
    @Schema(description = "单元名称")
    private String unitName;
    
    @Schema(description = "楼栋ID")
    private Long buildingId;
    
    @Schema(description = "楼栋名称")
    private String buildingName;
    
    @Schema(description = "社区ID")
    private Long communityId;
    
    @Schema(description = "社区名称")
    private String communityName;
    
    @Schema(description = "物业公司ID")
    private Long propertyCompanyId;
    
    @Schema(description = "物业公司名称")
    private String propertyCompanyName;
    
    /**
     * 构造函数，用于快速创建缴费场景所需的基本信息
     * 
     * @param householdId 房户ID
     * @param communityId 社区ID
     * @param propertyCompanyId 物业公司ID
     */
    public RegionHierarchyInfo(Long householdId, Long communityId, Long propertyCompanyId) {
        this.householdId = householdId;
        this.communityId = communityId;
        this.propertyCompanyId = propertyCompanyId;
    }
    
    /**
     * 检查层级信息是否完整
     * 至少需要有房户ID、社区ID和物业公司ID
     * 
     * @return 是否完整
     */
    public boolean isComplete() {
        return householdId != null && communityId != null && propertyCompanyId != null;
    }
    
    /**
     * 检查是否可以进行缴费
     * 必须有物业公司ID才能获取收款二维码
     * 
     * @return 是否可以缴费
     */
    public boolean canPay() {
        return propertyCompanyId != null;
    }
}
